package com.scedu.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

//@Component 组件
@Component //等价于 <bean id="user" class="com.scedu.entity.User"></bean>
@Scope(value = "singleton") //相当于  <bean id="user" class="com.scedu.entity.User" scope="singleton">
public class User {
    @Value("小王") //相当于  <property name="name" value="小王"></property>
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                '}';
    }
}
